package top.fyukina.fymil;

import top.fyukina.fymil.internal.cmds.*;
import top.fyukina.fymil.internal.exps.*;
import top.fyukina.fymil.parsers.*;
import java.util.LinkedList;
import java.util.List;

public class Registry {
    public final NumberParser numParser;
    public final BooleanParser boolParser;
    public final StringParser strParser;
    public final CommandParser cmdParser;
    public final ExpressionParser expParser;
    public final CommonParser comParser;
    public Registry() {
        //Registering parsers...
        cmdParser = new CommandParser();
        expParser = new ExpressionParser();
        numParser = new NumberParser();
        boolParser = new BooleanParser();
        strParser = new StringParser();
        comParser = new CommonParser();
        //Registering commands...
        List<Command> inCmds = new LinkedList<>();
        //TODO 待升级成包扫描
        inCmds.add(new Print());
        inCmds.add(new If());
        inCmds.add(new Input());
        inCmds.add(new Shut());
        inCmds.add(new Var());
        inCmds.add(new While());
        inCmds.add(new Listvar());
        cmdParser.register(inCmds);
        //Registering expressions...
        List<Expression<?>> inExps = new LinkedList<>();
        inExps.add(new Of());
        inExps.add(new Abs());
        inExps.add(new Negate());
        inExps.add(new BooleanExp());
        inExps.add(new CompareExp());
        inExps.add(new NumberExp());
        inExps.add(new StringExp());
        inExps.add(new Square());
        inExps.add(new SquareRoot());
        inExps.add(new Cubic());
        expParser.register(inExps);
    }
}